var fs = require('fs')

// json文件目录
var simpleFilePath = './statistic/03_douban/simple.json'
var backgroundFilePath = './statistic/03_douban/background.json'
var img1FilePath = './statistic/03_douban/img_1.json'
var img2FilePath = './statistic/03_douban/img_2.json'

const loadData = function(url) {
    var temp = fs.readFileSync(url, 'utf8')
    var temps = JSON.parse(temp)
    return temps
}



var simples = {
    data:loadData(simpleFilePath)
}

var backgrounds = {
    data:loadData(backgroundFilePath)
}


var img1 = {
    data:loadData(img1FilePath)
}
var img2 = {
    data:loadData(img2FilePath)
}




// 模块导出
// 定义相关函数

var res = {}


res.simpleAll = function() {
    var contents = simples.data
    return contents
}
res.backgroundAll = function() {
    var contents = backgrounds.data
    return contents
}

res.img1All = function() {
    var contents = img1.data
    return contents
}
res.img2All = function() {
    var contents = img2.data
    return contents
}





//导出一个对象，可直接引用
module.exports = res
